<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./lib/react/react.development.js"></script>
    <script src="./lib/react/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
    <style>
      .red {
        color: red;
      }
      .bg {
        background: #00ff00;
      }
    </style>
  </head>
  <body>
    <div id="app"></div>

    <script type="text/babel">
      const msg = "前端小溪";
      let arr = [1, 2, 3, 5];
      //   行内样式
      let style = { background: "#ffff00", color: "green" };

      class HelloWorld extends React.Component {
        render() {
          return (
            //   行内样式 需要对象形式, {}表达式作用域
            <div style={{ color: "red" }}>
              {msg}
              <p style={style}>{arr}</p>
              {/* 在JSX中,属性不应该采用关键词,比如class,if,for等,样式应该书写在 className中: */}
              <p className={"red bg"}>{msg}</p>
            </div>
          );
        }
      }
      ReactDOM.render(<HelloWorld />, document.getElementById("app"));
    </script>
  </body>
</html>
